import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger'
import { IsNotEmpty, IsInt, IsDefined } from 'class-validator'

/*
 * @Author: fhw
 * @Date: 2022-07-28 16:16:31
 * @LastEditors: Please set LastEditors
 * @LastEditTime: 2022-11-19 15:58:19
 * @Description:
 */
export class PageDto {
  @ApiPropertyOptional({
    type: String,
    name: 'pageSize',
    description: 'pageSize',
  })
  public pageSize?: number
  @ApiPropertyOptional({
    type: String,
    name: 'pageNum',
    description: 'pageNum',
  })
  public pageNum?: number
}
export class IdDto {
  @ApiProperty({
    type: Number,
    name: 'id',
    description: 'id',
  })
  public readonly id: number
}
// 删除
export class DelteIdDto {
  @IsNotEmpty({ message: 'id不能为空' })
  @IsInt({ message: 'id不是整数' })
  @IsDefined()
  @ApiProperty({
    type: Number,
    name: 'id',
    description: 'id',
  })
  public readonly id: number
}

export class ResponseDto {
  @ApiProperty({ example: 'data', description: 'data' })
  data: string;
  @ApiProperty({ example: 'msg', description: '消息' })
  msg: string;
  @ApiProperty({ example: 'code', description: '状态码' })
  code: number;
  @ApiProperty({ example: 'url', description: '地址' })
  url: string;
  @ApiProperty({ example: 'success', description: '状态' })
  success: boolean;
}